var teacherModule = require('./teacher.js');
class klass{
    constructor(number){
        this.number = number;
        this.teachers = [];
    }
    assignLeader(student){

        if(student.klassObj.number == this.number){
            this.leader = student;
            for (var teacherObj of this.teachers){
                if(teacherObj.isTeaching(student)){
                    console.log(`I am ${teacherObj.name}. I know ${student.name} become Leader of Class ${this.number}.`);
                }
            }
        }else{
            console.log('It is not one of us.');
        }
    }
    appendMember(student){
        student.klassObj = this;
        for (var teacherObj of this.teachers){
            if(teacherObj.isTeaching(student)){
                console.log(`I am ${teacherObj.name}. I know ${student.name} has joined Class ${this.number}.`);
            }
        }
    }
    isIn(student){
        return (student.klassObj.number === this.number) ? true : false;
    }
    addTeacher(teacher){
        this.teachers.push(teacher);
    }
}

module.exports.klass = klass;